package com.bos.service.imp;

import com.bos.dao.IRegionDao;
import com.bos.domain.Region;
import com.bos.service.IRegionService;
import com.bos.utils.PageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Administrator
 */
@Service
@Transactional
public class IRegionServiceImp implements IRegionService {

    @Autowired
    private IRegionDao regionDao;

    @Override
    public void save(ArrayList<Region> regions) {
        for (Region region:regions) {
            regionDao.saveOrUpdate(region);
        }
    }

    @Override
    public void pageQuery(PageBean pageBean) {
        regionDao.pageQuery(pageBean);
    }

    @Override
    public List<Region> findAll() {
        return regionDao.findAll();
    }

    @Override
    public List<Region> findAllByq(String q) {
        return regionDao.findAllByq(q);
    }
}
